//
//  TFPositionButton.h
//  TFFoundation
//
//  Created by TFAppleWork-Summer on 2017/3/30.
//  Copyright © 2017年 TFAppleWork-Summer. All rights reserved.
//

#import <UIKit/UIKit.h>

/**
 按钮位置类型
 */
typedef NS_ENUM(NSUInteger, TFPositionButtonType) {
    /**
     竖直标题+图片
     */
    TFPositionButtonTypeVerticalTitleImage,
    /**
     竖直图片+标题
     */
    TFPositionButtonTypeVerticalImageTitle,
    /**
     水平标题+图片
     */
    TFPositionButtonTypeHorizontalTitleImage,
    /**
     水平图片+标题
     */
    TFPositionButtonTypeHorizontalImageTitle,
};

/**
 可设置按钮位置的对象
 */
@interface TFPositionButton : UIControl

/**
 根据位置类型创建按钮

 @param positionType 位置类型
 @return TFPositionButton
 */
+ (nonnull instancetype)buttonWithPositionType:(TFPositionButtonType)positionType;

/**
 按钮位置类型
 */
@property (nonatomic, assign, readonly) TFPositionButtonType positionType;

/**
 内容插入的边距
 */
@property (nonatomic, assign) UIEdgeInsets contentEdgeInsets;

/**
 标题内容插入的边距
 */
@property (nonatomic, assign) UIEdgeInsets titleEdgeInsets;

/**
 图片内容插入的边距
 */
@property (nonatomic, assign) UIEdgeInsets imageEdgeInsets;

/**
 设置按钮标题

 @param title 标题
 @param state 状态
 */
- (void)setTitle:(nullable NSString *)title forState:(UIControlState)state;

/**
 设置标题颜色

 @param color 标题颜色
 @param state 状态
 */
- (void)setTitleColor:(nullable UIColor *)color forState:(UIControlState)state;

/**
 设置图片

 @param image 图片
 @param state 状态
 */
- (void)setImage:(nullable UIImage *)image forState:(UIControlState)state;

/**
 设置背景图片

 @param image 背景图片
 @param state 状态
 */
- (void)setBackgroundImage:(nullable UIImage *)image forState:(UIControlState)state;

/**
 设置属性字符串

 @param title 标题
 @param state 状态
 */
- (void)setAttributedTitle:(nullable NSAttributedString *)title forState:(UIControlState)state;

/**
 获取对应状态下的标题

 @param state 状态
 @return NSString
 */
- (nullable NSString *)titleForState:(UIControlState)state;

/**
 获取对应状态下的图片颜色

 @param state 状态
 @return UIColor
 */
- (nullable UIColor *)titleColorForState:(UIControlState)state;

/**
 获取对应状态下的图片

 @param state 状态
 @return UIImage
 */
- (nullable UIImage *)imageForState:(UIControlState)state;

/**
 获取对应状态下的背景图片

 @param state 状态
 @return 背景图片
 */
- (nullable UIImage *)backgroundImageForState:(UIControlState)state;

/**
 获取对应状态下的属性字符串

 @param state 状态
 @return NSAttributedString
 */
- (nullable NSAttributedString *)attributedTitleForState:(UIControlState)state;

/**
 当前标题
 */
@property(nullable, nonatomic,readonly,strong) NSString *currentTitle;

/**
 当前标题颜色
 */
@property(nullable,nonatomic,readonly,strong) UIColor  *currentTitleColor;

/**
 当前图片
 */
@property(nullable, nonatomic,readonly,strong) UIImage  *currentImage;

/**
 当前背景图片
 */
@property(nullable, nonatomic,readonly,strong) UIImage  *currentBackgroundImage;

/**
 当前属性字符串
 */
@property(nullable, nonatomic,readonly,strong) NSAttributedString *currentAttributedTitle;

/**
 文字label
 */
@property(nullable, nonatomic,readonly,strong) UILabel *titleLabel;

/**
 图片view
 */
@property(nullable, nonatomic,readonly,strong) UIImageView *imageView;

/**
 背景图片view
 */
@property(nullable, nonatomic,readonly,strong) UIImageView *backgroundImageView;


@end
